package Day02;

import java.util.Scanner;
import java.util.Stack;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-09-06
 * Time: 10:29
 * To BE A Better Person-2020-3-2
 */
public class TestDemo{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        Stack<String> stack=new Stack<>();
        String ret=null;
        int prevIndex=0;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i)==' '){
                stack.push(s.substring(prevIndex,i));
                prevIndex=i+1;
            }

        }
        stack.push(s.substring(prevIndex,s.length()));
        while(!stack.isEmpty()){
            //字符串拼接
            System.out.print(stack.pop()+" ") ;
        }

    }
}
